<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let arr=[]
  for(i=1;i<=5;i++){
       let num =+prompt('输入五个年龄')
       arr.push(num)
  }
  let chengnianAge=0
  let average=0
    for(i=0;i<arr.length;i++){
      if(arr[i]>=18&&arr[i]<=100){
        console.log(` ${arr[i]}`)
      }

      chengnianAge = chengnianAge + arr[i]
      average= chengnianAge / arr.length
    }
    console.log(`成年人年龄和${chengnianAge}`)
    console.log(`平均年龄${average}`)
    

   let max=arr[0]
   let min=arr[0]
   for(let k=1;k<arr.length;k++){
     if(max<arr[k]){
       max=arr[k]
     }
     if(min> arr[k]){
        min=arr[k]
     }
   }
console.log(min)
console.log(max)
  </script>
</body>
</html>